package tag20_06_08.lokaleklassen;

import java.util.Comparator;

class Person implements Comparable<Person> {
	
	public static Comparator<Person> getReverseComparator() {
		
		class CmpReverse implements Comparator<Person> {
			public int compare(Person p1, Person p2) {
				return p2.compareTo(p1);
			}
		}
		
		return new CmpReverse();
	}
	
	//-------------------------------------
	String name;
	int geburtsjahr;
	
	public int compareTo(Person p2) {
		int erg = name.compareTo(p2.name);
		
		return erg != 0 ? erg : geburtsjahr - p2.geburtsjahr;
	}
}

public class ObjecteVonInnerenTypenLiefern {

	public static void main(String[] args) {
		Comparator<Person> cmp = Person.getReverseComparator();
		System.out.println(cmp);
	}

}
